package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ChildSicknessBean;
import com.xuxin.baby.contract.ChildSicknessContract;
import com.xuxin.baby.model.ChildSicknessModel;

/**
 * Created by xu_xin
 * Created on 2020/10/22 0022
 * 看病记录
 */
public class ChildSicknessPresenter implements ChildSicknessContract.Presenter {
    private  final ChildSicknessModel model;
    private  final ChildSicknessContract.View view;

    public ChildSicknessPresenter(ChildSicknessContract.View view) {
        this.view = view;
        model = new ChildSicknessModel();
    }

    @Override
    public void getChildSickness(String tenantId,
                                 String token,
                                 String childId,
                                 String eventType,
                                 int skipCount,
                                 int maxCount) {
        if (null != model) {
            model.getChildSickness(this,
                    tenantId,
                    token,
                    childId,
                    eventType,
                    skipCount,
                    maxCount);
        }
    }

    @Override
    public void onSuccess(ChildSicknessBean childSicknessBean) {
        if (null != view) {
            view.onSuccess(childSicknessBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}